package com.larry.rabbitmq.seventh;

import com.larry.rabbitmq.util.RabbitMQUtils;
import com.rabbitmq.client.Channel;

import java.util.HashMap;
import java.util.Map;

/**
 * @author larry
 * @Title: larry-rabbitmq
 * @Package com.larry.rabbitmq.seventh
 * @Description: 发送消息
 * @date 7/1/2110:30 PM
 */
public class EmitLogTopic {

    public static final String EXCHANGE_NAME = "topic_logs";

     public static void main(String args[]) throws Exception{
         Channel channel = RabbitMQUtils.getChannel();

         Map<String,String> map = new HashMap<>();
         map.put("quick.orange.rabbit","q1q2");
         map.put("lazy.orange.elephant","q1q2");
         map.put("quick.orange.fox","q1");
         map.put("lazy.brown.fox","q2");
         map.put("lazy.pink.rabbit","q2");
         map.put("quick.brown.fox","0");
         map.put("quick.orange.male.rabbit","0");
         map.put("lazy.orange.male.rabbit","q2");

         for (Map.Entry<String, String> entry : map.entrySet()) {
             String key = entry.getKey();
             String message = entry.getValue();
             channel.basicPublish(EXCHANGE_NAME,key,null,message.getBytes());
             System.out.println("发送消息......: " + message);
         }
     }
}
